package com.example.server.impl;

import com.example.dao.vehicleMapper.VehicleMapper;
import com.example.dto.vehicle.Vehicle;
import com.example.server.VehicleServer;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import java.util.HashMap;
import java.util.Map;

@Service
public class VehicleServerImpl implements VehicleServer {

    @Autowired
    private VehicleMapper vehicleMapper;

    @Override
    @Transactional(rollbackFor = Exception.class)
    public Map<String, Object> creat(Vehicle vehicle) {
        Map<String, Object> result = new HashMap<>(4);
        vehicleMapper.creat(vehicle);
        result.put("code", 200);
        result.put("msg", "添加成功");
        return result;
    }
}
